<template>
	<view class="myhome">
		<view class="beijing">
			<img :src="pcmyimage.image_url" />
		</view>
		<!-- <view class="bjimg">
			<van-image round width="6rem" height="6rem" src="https://img.yzcdn.cn/vant/cat.jpeg" />

		</view> -->
		<!-- <view class="mysd">
			<view class="mysdtext">
				<view>
				我的店铺
			</view>
			<image class="mysdimage" src="../../static/sd.png"></image>
			</view>
			
		</view> -->
		<!-- <view class="mydp">
			<van-cell size="30px" @click="gotomydp()" title="我的店铺" is-link value="前去我的店铺" />
		</view> -->
		<!-- <view class="mybutton">
			<van-cell title="我的信息" @click="myxx()" is-link value="查看我的信息" />
			<van-cell title="系统信息" @click="gotoxt()" is-link value="查看系统信息" />
			<van-cell v-if="gly" title="退出登录" @click="delect()" is-link value="退出登录" />
		</view> -->
		<view class="lianxi">
			<view class="lianxitext">
				<view class="lxt">
					<view class="lximage">
						<van-icon name="location-o" size="22px" />
					</view>
					<view>地&emsp;&emsp;址</view>：
					<view class="lxtt">{{phone.name}}</view>
				</view>
				<view class="lxt">
					<view class="lximage">
						<van-icon name="phone-o" size="22px" />
					</view>
					<view>联系电话</view>：
					<view class="lxtt">{{phone.phone}}</view>
				</view>
				<view class="lxt">
					<view class="lximage">
						<van-icon name="envelop-o" size="22px" />
					</view>
					<view>邮&emsp;&emsp;箱</view>：
					<view class="lxtt">{{phone.email}}</view>
				</view>
				<view class="lxt">
					<view class="lximage">
						<van-icon name="tv-o" size="22px" />
					</view>
					<view>官&emsp;&emsp;网</view>：
					<view class="lxtt">{{phone.wangzhi}}</view>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				logindata: 0,
				gly: '',
				pcmyimage:[],
				phone: []
			}
		},
		onShow() {
		let urlon = `/1.1/classes/x_my_image`
		this.$get(urlon).then(res => {
			uni.stopPullDownRefresh()
			this.pcmyimage = res.results[0]
				
		
		})
		},
		methods: {
			
			offlogin() {
				console.log("我出发了")
				if (uni.getStorageSync('username')) {
					// 用户已经登录，执行相关操作
					console.log("一登陆")
					this.gly = true
					console.log(this.gly)
				}
			},
			gotomydp() {
				// if(this.logindata!==1)
				// {
				// 	console.log("没登录")
				// }
				if (uni.getStorageSync('username')) {
					// 用户已经登录，执行相关操作
					// console.log("一登陆")
					uni.navigateTo({
						url: '/pages/mydp/mydp'
					})

				} else {
					// 用户未登录，跳转到登录页面
					uni.navigateTo({
						url: '/pages/login/login'
					});
				}

			},
			delect() {
				uni.removeStorageSync('username');
				// location.reload();
				this.gly = false
				uni.redirectTo({
					url: '/pages/index/index'
				})

			},
			gotoxt() {
				uni.navigateTo({
					url: '/pages/xtxx/xtxx'
				})
			},
			myxx() {
				if (uni.getStorageSync('username')) {
					// 用户已经登录，执行相关操作
					// console.log("一登陆")
					uni.navigateTo({
						url: '/pages/myxx/myxx'
					})

				} else {
					// 用户未登录，跳转到登录页面
					uni.navigateTo({
						url: '/pages/login/login'
					});
				}
			},
			async loadData() {
				
					uni.request({
					        url: 'http://localhost:8080/oll/all',
					        method: 'GET',
					        success: (res) => {
					          console.log(res);
							  this.phone =res.data[0]
					        },
					        fail: (err) => {
					          console.error(err);
					        },
					      });
					// const res = await this.$get(url);
					
					// this.phone = res.results[0]
				
			}

		},


		onLoad() {
			this.offlogin(),
				this.loadData()
		}

	}
</script>

<style>
	.lxtt {
		margin-left: 8px;
	}

	.lianxi {
		width: 100%;
		height: 180px;
		/* border: 1px solid black; */

	}

	.lianxitext {
		width: 330px;
		height: 180px;
		margin: 0 auto;
		/* border: 1px solid black; */
		background-color: rgb(245, 245, 245);


	}

	.lxt {
		width: fit-content;
		height: 40px;
		/* border: 1px solid black; */
		display: flex;
		line-height: 40px;
		margin-top: 5px;
		margin-left: 10px;
	}

	.lximage {
		width: 30px;
		height: 30px;
		/* border: 1px solid red; */
		margin-top: 3px;
	}

	.lximage image {
		width: 100%;
		height: 100%;
	}

	.beijing {
		width: 100%;
		/* border: 1px solid black; */
		position: relative;
	}

	.beijing img {
		width: 100%;
	}

	.bjimg {
		position: absolute;
		top: 168px;
		/* left:150px; */
		/* left: 170px; */
		width: 100px;
		height: 100px;
		/* border:1px solid black; */
		margin: 0 auto;
	}

	.mybutton {
		/* background-color: rgb(245,245,245); */
		/* border: 1px solid black; */
		margin-top: 10px;
	}

	.mydp {
		margin-top: 24px;
	}
</style>